//管理多个reducer函数功能的模块
function counter(state = 0, action) {
  // console.log(state);
  //初始状态为0

  // console.log(action);
  //{type: '@@redux/INITe.p.e.u.7.h'}
  //{type: 'INCREMENT', data: 1}

  //判断action的类型返回对应的新的state数据
  switch (action.type) {
    case 'INCREMENT':
      return state + action.data;
    case 'DECREMENT':
      return state - action.data;
    default:
      return state;
  }
}

export { counter };
